/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class HashBuck2 <K,V>{
    class Node<K,V>{
        public K key;
        public V value;
        public Node<K,V> next;

        public Node(K key, V value) {
            this.key = key;
            this.value = value;
        }
    }
    public Node<K,V>[] array =(Node<K,V>[])new Node[10];
    public int numsize;
    public static final double LOAD_FACTOR = 0.75d;
    public void put(K key,V value){
        int index = Math.abs(key.hashCode()%array.length);
        Node<K,V> cur = array[index];
        while (cur!=null){
            if (cur.key.equals(key)){
                cur.value=value;
                return;
            }
            cur=cur.next;
        }
        Node<K,V> node =new Node<>(key, value);
        node.next=array[index];
        array[index] =node;
        numsize++;
        if (numsize*1.0/array.length>=LOAD_FACTOR){
            resize(); //扩容
        }
    }

    private void resize() {
    }
}
